/*
{
"状态":1,
"名称":"新增-权限角色资料",
"作者":"马学兵",
"创建时间":"2018-08-20",
"功能":"新增-权限角色资料",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

DECLARE @power VARCHAR(4000)
DECLARE @role VARCHAR(4000)

set @power='{power}'
set @role='{role}'

INSERT INTO y_role_power(power_key,role_key,create_time,update_time)
SELECT A.power_key,A.role_key,GETDATE(),GETDATE() FROM (
SELECT A.value AS power_key,B.value AS role_key FROM dbo.Ft_Split(@power,',') A CROSS JOIN  dbo.Ft_Split(@role,',') B
) A LEFT JOIN y_role_power B ON B.power_key = A.power_key AND B.role_key = A.role_key 
where B.role_key IS NULL 